package com.own.component.util.database.mysql;

import com.own.component.util.database.base.BaseDatabaseFieldMapping;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * MysqlFieldMappingEnum
 *
 * @author chenxueli
 * @date 2022-10-15 14:02:49
 */
@AllArgsConstructor
public enum MysqlFieldMappingEnum implements BaseDatabaseFieldMapping {

    // 默认
    DEFAULT("varchar", "String", "", "string"),

    /* 数字类型 */
    /**
     * INT
     */
    INT("int", "Integer", "", "number"),
    /**
     * INT
     */
    INTEGER("integer", "Integer", "", "number"),
    /**
     * TINYINT
     */
    TINYINT("tinyint", "Integer", "", "number"),
    /**
     * SMALLINT
     */
    SMALLINT("smallint", "Integer", "", "number"),
    /**
     * MEDIUMINT
     */
    MEDIUMINT("mediumint", "Integer", "", "number"),
    /**
     * BIGINT
     */
    BIGINT("bigint", "Long", "", "number"),
    /**
     * FLOAT
     */
    FLOAT("float", "BigDecimal", "java.math.BigDecimal", "number"),
    /**
     * DOUBLE
     */
    DOUBLE("double", "BigDecimal", "java.math.BigDecimal", "number"),
    /**
     * DECIMAL
     */
    DECIMAL("decimal", "BigDecimal", "java.math.BigDecimal", "number"),

    /* 时间类型 */
    /**
     * DATE
     */
    DATE("date", "LocalDate", "java.time.LocalDate", "Date"),
    /**
     * TIME
     */
    TIME("time", "LocalTime", "java.time.LocalTime", "Date"),
    /**
     * DATETIME
     */
    DATETIME("datetime", "LocalDateTime", "java.time.LocalDateTime", "Date"),
    /**
     * YEAR
     */
    YEAR("year", "String", "", "string"),
    /**
     * TIMESTAMP
     */
    TIMESTAMP("timestamp", "Long", "", "number"),

    /* 字符串类型 */

    /**
     * CHAR
     */
    CHAR("char", "String", "", "string"),
    /**
     * VARCHAR
     */
    VARCHAR("varchar", "String", "", "string"),
    /**
     * TINYBLOB
     */
    TINYBLOB("tinyblob", "String", "", "string"),
    /**
     * TINYTEXT
     */
    TINYTEXT("tinytext", "String", "", "string"),
    /**
     * BLOB
     */
    BLOB("blob", "String", "", "string"),
    /**
     * TEXT
     */
    TEXT("text", "String", "", "string"),
    /**
     * MEDIUMBLOB
     */
    MEDIUMBLOB("mediumblob", "String", "", "string"),
    /**
     * MEDIUMTEXT
     */
    MEDIUMTEXT("mediumtext", "String", "", "string"),
    /**
     * LONGTEXT
     */
    LONGTEXT("longtext", "String", "", "string");

    @Getter
    private final String databaseType;
    @Getter
    private final String javaType;
    @Getter
    private final String importPath;
    @Getter
    private final String typescriptType;


    /**
     * 数据库类型
     *
     * @return 数据库类型
     */
    @Override
    public String databaseType() {
        return databaseType;
    }

    /**
     * java类型
     *
     * @return java类型
     */
    @Override
    public String javaType() {
        return javaType;
    }

    /**
     * java类型全路径（多个用;分隔）
     *
     * @return java类型全路径
     */
    @Override
    public String importPath() {
        return importPath;
    }

    /**
     * typescript类型
     *
     * @return typescript类型
     */
    @Override
    public String typescriptType() {
        return typescriptType;
    }

}
